<?php /* Smarty version 2.6.20, created on 2016-07-19 17:02:32
         compiled from product_cat.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'in_array', 'product_cat.htm', 123, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品分类</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>产品分类</h3>
                <ul>
                    <li <?php if ($_GET['operation'] == ''): ?>class="current"<?php endif; ?>><a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
"><span>管理</span></a></li>
                   	<li <?php if ($_GET['operation'] == 'add'): ?>class="current"<?php endif; ?>><a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=add"><span>添加</span></a></li>
                    <?php if ($_GET['operation'] == 'edit'): ?>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
        <div class="h35"></div>
        <form action="" method="post">
        <?php if ($_GET['operation'] == 'add' || $_GET['operation'] == 'edit'): ?>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['re']['catid']; ?>
">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">产品分类</th>
                    </tr>
                </thead>
                <tbody>
                
                <tr>
                    <td width="100">分类</td>
                    <td>
                    <select class="ws350" name='pid' >
                    	<option value='0'>顶级类别</option>
                        <?php $_from = $this->_tpl_vars['de']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             			<option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['list']['catid'] || $_GET['catid'] == $this->_tpl_vars['list']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['slist']['catid'] || $_GET['catid'] == $this->_tpl_vars['slist']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
">|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['lists']['catid'] || $_GET['catid'] == $this->_tpl_vars['lists']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
">|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
               
                <tr>
                    <td>分类名</td>
                    <td>
                    <?php if ($_GET['operation'] == 'edit'): ?>
                    <input name="cat" type="text" id="cat" class="w350" value="<?php echo $this->_tpl_vars['re']['cat']; ?>
"/>
                    <?php else: ?>
                    <textarea name="cat" id="cat" class="w350" rows="10"></textarea>
                    <div>可批量添加，每行一个分类</div>
                    <?php endif; ?>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                <tr>
                    <td>关连属性集</td>
                    <td>
                    <select class="ws350" name="ext_field_cat" >
              		<option value="">不关连属性集</option>
                    <?php $_from = $this->_tpl_vars['property']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                    <option <?php if ($this->_tpl_vars['re']['ext_field_cat'] == $this->_tpl_vars['list']['id']): ?>selected="selected"<?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['list']['name']; ?>
</option>
                    <?php endforeach; endif; unset($_from); ?>
                    </select>
                    </td>
                </tr>
                
                <tr>
                    <td>显示</td>
                    <td>
                    <input type="checkbox" value="1" id="isindex" name="isindex"  <?php if ($this->_tpl_vars['re']['isindex']): ?> checked="checked" <?php endif; ?> >
                    </td>
                </tr>
                
                
                <tr>
                    <td>税率</td>
                    <td>
                    <input type="text" id="tax_rate" name="tax_rate"  value="<?php echo $this->_tpl_vars['re']['tax_rate']; ?>
" >
                    </td>
                </tr>
                
                <tr>
                    <td>HSCODE</td>
                    <td>
                    <input type="text" id="hscode" name="hscode"  value="<?php echo $this->_tpl_vars['re']['hscode']; ?>
" >
                    </td>
                </tr>
                
                <tr>
                    <td>关联品牌</td>
                    <td>
                    <?php $_from = $this->_tpl_vars['brand']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        <?php if ($this->_tpl_vars['list']['brand']): ?>
                        <dl class="brand">
                            <dt><?php echo $this->_tpl_vars['list']['catname']; ?>
</dt>
                            <dl>
                            <?php $_from = $this->_tpl_vars['list']['cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['cat']):
?>
                                <?php if ($this->_tpl_vars['cat']['brand']): ?>
                                <?php if ($this->_tpl_vars['cat']['catname']): ?>
                                <p><?php echo $this->_tpl_vars['cat']['catname']; ?>
</p>
                                <?php endif; ?>
                                <ul class="<?php if ($this->_tpl_vars['cat']['catname']): ?>fr<?php else: ?>fl<?php endif; ?>">
                                <?php $_from = $this->_tpl_vars['cat']['brand']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                                <li>
                                <input <?php if (@ ((is_array($_tmp=$this->_tpl_vars['slist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['re']['brands']) : in_array($_tmp, $this->_tpl_vars['re']['brands']))): ?>checked="checked"<?php endif; ?> id="c<?php echo $this->_tpl_vars['slist']['id']; ?>
" name="brand[]" type="checkbox" value="<?php echo $this->_tpl_vars['slist']['id']; ?>
">
                                <label for="c<?php echo $this->_tpl_vars['slist']['id']; ?>
"><?php echo $this->_tpl_vars['slist']['name']; ?>
</label>
                                </li>
                                <?php endforeach; endif; unset($_from); ?>
                                </ul>
                                <div class="clear"></div>
                                <?php endif; ?>
                            <?php endforeach; endif; unset($_from); ?>
                            </dl>
                        </dl>
                        <?php endif; ?>
                    <?php endforeach; endif; unset($_from); ?> 
                    </td>
                </tr>
                
                
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<?php if (! $_GET['editid']): ?>save<?php else: ?>edit<?php endif; ?>">
                   
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
        <?php else: ?>
        <table class="table">
        	
            <tbody>
                <tr class="header partition">
                    <th width="30"></th>
                    <th width="70">显示顺序</th>
                    <th>分类名称</th>
                    <th>关联属性</th>
                    <th>显示</th>
                    <th width="70"></th>
                </tr>
            </tbody>  
              
            <?php $_from = $this->_tpl_vars['de']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['list']):
?>
            <tbody>
                <tr>
                	<?php if ($this->_tpl_vars['list']['scat']): ?>
                	<td onclick="toggle_group('group_<?php echo $this->_tpl_vars['list']['catid']; ?>
')">
                    <a id="a_group_<?php echo $this->_tpl_vars['list']['catid']; ?>
" href="javascript:void(0)"><?php if ($this->_tpl_vars['key'] > 0): ?>[+]<?php else: ?>[-]<?php endif; ?></a>
                    </td>
                    <?php else: ?><td></td><?php endif; ?>
                    <td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['list']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['list']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td>
                        <input type="text" class="w150" name="name[<?php echo $this->_tpl_vars['list']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['list']['cat']; ?>
" />
                        <a class="addchildboard" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=add&catid=<?php echo $this->_tpl_vars['list']['catid']; ?>
">添加子分类</a>
                    </td>
                    <td><?php if ($this->_tpl_vars['list']['property']): ?><?php echo $this->_tpl_vars['list']['property']; ?>
<?php else: ?>通用<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['list']['isindex'] == 1): ?>显示<?php else: ?>不显示<?php endif; ?></td>
                    <td>
					<a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=edit&editid=<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&delid=<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>
                  
                   </td>
                </tr>
            </tbody>
            
            <?php if ($this->_tpl_vars['list']['scat']): ?>
            <tbody id="group_<?php echo $this->_tpl_vars['list']['catid']; ?>
" <?php if ($this->_tpl_vars['key'] > 0): ?>style="display:none;"<?php endif; ?>>
            <?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                <tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['slist']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['slist']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="board"><input type="text" class="w150" name="name[<?php echo $this->_tpl_vars['slist']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['slist']['cat']; ?>
" /><a class="addchildboard" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=add&catid=<?php echo $this->_tpl_vars['slist']['catid']; ?>
">添加子分类</a></div></td>
                    <td><?php if ($this->_tpl_vars['slist']['property']): ?><?php echo $this->_tpl_vars['slist']['property']; ?>
<?php else: ?>通用<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['slist']['isindex'] == 1): ?>显示<?php else: ?>不显示<?php endif; ?></td>
                    <td>
					<a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=edit&editid=<?php echo $this->_tpl_vars['slist']['catid']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&delid=<?php echo $this->_tpl_vars['slist']['catid']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>
                   </td>
                </tr>
            
			<?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['clist']):
?>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['clist']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['clist']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childboard"><input type="text" class="w150" name="name[<?php echo $this->_tpl_vars['clist']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['clist']['cat']; ?>
" /><a class="addchildboard" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=add&catid=<?php echo $this->_tpl_vars['clist']['catid']; ?>
">添加子分类</a></div></td>
                    <td><?php if ($this->_tpl_vars['clist']['property']): ?><?php echo $this->_tpl_vars['clist']['property']; ?>
<?php else: ?>通用<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['clist']['isindex'] == 1): ?>显示<?php else: ?>不显示<?php endif; ?></td>
                    <td>
					<a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=edit&editid=<?php echo $this->_tpl_vars['clist']['catid']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&delid=<?php echo $this->_tpl_vars['clist']['catid']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>
                   </td>
                </tr>
             <?php $_from = $this->_tpl_vars['clist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['lists']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['lists']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childsboard"><input type="text" class="w150" name="name[<?php echo $this->_tpl_vars['lists']['catid']; ?>
]" value="<?php echo $this->_tpl_vars['lists']['cat']; ?>
" /></div></td>
                    <td><?php if ($this->_tpl_vars['lists']['property']): ?><?php echo $this->_tpl_vars['lists']['property']; ?>
<?php else: ?>通用<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['lists']['isindex'] == 1): ?>显示<?php else: ?>不显示<?php endif; ?></td>
                    <td>
					<a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&operation=edit&editid=<?php echo $this->_tpl_vars['lists']['catid']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
&delid=<?php echo $this->_tpl_vars['lists']['catid']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>
                   </td>
                </tr>
            <?php endforeach; else: ?>
            <?php endif; unset($_from); ?>   
            <?php endforeach; else: ?>
            <?php endif; unset($_from); ?>
            <?php endforeach; else: ?>
            <?php endif; unset($_from); ?>
            </tbody>
            <?php endif; ?>
            <?php endforeach; else: ?>
            <tr>
                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
            </tr>
            <?php endif; unset($_from); ?>
            <tfoot>
                <tr>
                	<td colspan="2">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" name="submit" value="<?php echo $this->_tpl_vars['lang']['btn_submit']; ?>
" />
                    </td>
                    <td colspan="99"><div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div></td>
                </tr>
            </tfoot>
        </table>
        </form>
        <?php endif; ?>
    </div>
</body>
<script>
function toggle_group(oid, conf) {
	obj = $('#a_'+oid)[0];
	if(!conf) {
		var conf = {'show':'[-]','hide':'[+]'};
	}
	var obody = $('#'+oid)[0];
	if(obody.style.display == 'none') {
		obody.style.display = '';
		obj.innerHTML = conf.show;
	} else {
		obody.style.display = 'none';
		obj.innerHTML = conf.hide;
	}
}
</script>
</html>